Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Runtime] Add graph_executor get_input_index API. #8633

Merged
merged 5 commits into from
Aug 4, 2021

Conversation

huajsj
Copy link
Contributor

@huajsj huajsj commented Aug 3, 2021

In graph_executor use case, user can use set_input with input index to set input parameter, but there is no straight
forward way to get correct index number with input name, here provide get_input_index API to do such work.

In graph_executor use case, user can use set_input with
input index to set input parameter, but there is no straight
forward way to get correct index number with input name, here
provide get_input_index API to do such work.
Copy link
Contributor

@jcf94 jcf94 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

python/tvm/contrib/graph_executor.py Outdated Show resolved Hide resolved
python/tvm/contrib/graph_executor.py Outdated Show resolved Hide resolved
python/tvm/contrib/graph_executor.py Show resolved Hide resolved
src/runtime/graph_executor/graph_executor.cc Outdated Show resolved Hide resolved
huajsj and others added 4 commits August 3, 2021 11:23
Co-authored-by: Cody Yu <comaniac0422@gmail.com>
Co-authored-by: Cody Yu <comaniac0422@gmail.com>
Co-authored-by: Cody Yu <comaniac0422@gmail.com>
Co-authored-by: Cody Yu <comaniac0422@gmail.com>
Copy link
Contributor

@comaniac comaniac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@tkonolige
Copy link
Contributor

@huajsj Could you also add this to the VM api?

@huajsj
Copy link
Contributor Author

huajsj commented Aug 3, 2021

@huajsj Could you also add this to the VM api?

@tkonolige, thanks for the comments, how about I use a separate PR to address this VM support issue?

@tkonolige
Copy link
Contributor

@huajsj Totally fine, I don't want to block this PR. It just would be nice to have the api be the same between the graph runtime and the vm.

@huajsj
Copy link
Contributor Author

huajsj commented Aug 3, 2021

@tkonolige, thanks for the follow up, sure, would do that.

@masahi masahi merged commit 9dfcb22 into apache:main Aug 4, 2021
mehrdadh pushed a commit to mehrdadh/tvm that referenced this pull request Aug 11, 2021
* [Runtime] Add graph_executor get_input_index API.

In graph_executor use case, user can use set_input with
input index to set input parameter, but there is no straight
forward way to get correct index number with input name, here
provide get_input_index API to do such work.

* Update python/tvm/contrib/graph_executor.py

Co-authored-by: Cody Yu <comaniac0422@gmail.com>

* Update python/tvm/contrib/graph_executor.py

Co-authored-by: Cody Yu <comaniac0422@gmail.com>

* Update src/runtime/graph_executor/graph_executor.cc

Co-authored-by: Cody Yu <comaniac0422@gmail.com>

* Update python/tvm/contrib/graph_executor.py

Co-authored-by: Cody Yu <comaniac0422@gmail.com>

Co-authored-by: Cody Yu <comaniac0422@gmail.com>
@Lyken17
Copy link
Contributor

Lyken17 commented Aug 19, 2021

Hi there,

It seems this commit introduces bugs when tunning models on raspberry pis. When I follow the example on auto-scheduler-tune-network-arm, I got following errors

Upload...
Traceback (most recent call last):
  File "pi_bench/tune_mbv2.py", line 143, in <module>
    tune_and_evaluate()
  File "pi_bench/tune_mbv2.py", line 126, in tune_and_evaluate
    module = graph_executor.GraphModule(rlib["default"](dev))
  File "/home/ligeng/Workspace/tvm/python/tvm/contrib/graph_executor.py", line 160, in __init__
    self._get_input_index = module["get_input_index"]
  File "/home/ligeng/Workspace/tvm/python/tvm/runtime/module.py", line 107, in __getitem__
    return self.get_function(name)
  File "/home/ligeng/Workspace/tvm/python/tvm/runtime/module.py", line 91, in get_function
    raise AttributeError("Module has no function '%s'" % name)
AttributeError: Module has no function 'get_input_index'

After I comment the 160th line in python/tvm/contrib/graph_executor.py, the tutorial runs without problem.

@tkonolige
Copy link
Contributor

@Lyken17 Did you rebuild TVM on your raspberry pis? You can get this error when there is a TVM version mismatch between the remote and the host.

@Lyken17
Copy link
Contributor

Lyken17 commented Aug 20, 2021

@tkonolige I am using the tvm with commit dbf9ce52d4e4fbcd0c1d44f6c8d05c7774dffe63 (3 days ago) on both of my host and pis.

ylc pushed a commit to ylc/tvm that referenced this pull request Sep 29, 2021
* [Runtime] Add graph_executor get_input_index API.

In graph_executor use case, user can use set_input with
input index to set input parameter, but there is no straight
forward way to get correct index number with input name, here
provide get_input_index API to do such work.

* Update python/tvm/contrib/graph_executor.py

Co-authored-by: Cody Yu <comaniac0422@gmail.com>

* Update python/tvm/contrib/graph_executor.py

Co-authored-by: Cody Yu <comaniac0422@gmail.com>

* Update src/runtime/graph_executor/graph_executor.cc

Co-authored-by: Cody Yu <comaniac0422@gmail.com>

* Update python/tvm/contrib/graph_executor.py

Co-authored-by: Cody Yu <comaniac0422@gmail.com>

Co-authored-by: Cody Yu <comaniac0422@gmail.com>
ylc pushed a commit to ylc/tvm that referenced this pull request Jan 13, 2022
* [Runtime] Add graph_executor get_input_index API.

In graph_executor use case, user can use set_input with
input index to set input parameter, but there is no straight
forward way to get correct index number with input name, here
provide get_input_index API to do such work.

* Update python/tvm/contrib/graph_executor.py

Co-authored-by: Cody Yu <comaniac0422@gmail.com>

* Update python/tvm/contrib/graph_executor.py

Co-authored-by: Cody Yu <comaniac0422@gmail.com>

* Update src/runtime/graph_executor/graph_executor.cc

Co-authored-by: Cody Yu <comaniac0422@gmail.com>

* Update python/tvm/contrib/graph_executor.py

Co-authored-by: Cody Yu <comaniac0422@gmail.com>

Co-authored-by: Cody Yu <comaniac0422@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants